<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./OL_SDK/include-openlayers-local.js"></script>
    <script src="./libs/gaode.js"></script>
</head>

<body>
    <button onclick="addMap()">放大</button>
    <button onclick="reduceMap()">缩小</button>
    <button onclick="resetMap()">复位地图</button>
    <div id="map">
    </div>
    <script>
        var map = new ol.Map({
            target: "map",
            layers: [gaode],
            view: new ol.View({
                projection: 'EPSG:4326',
                center: [114.30, 30.50],
                zoom: 4
            })
        })
        const view = map.getView();
        function addMap() {
            let zoom = view.getZoom();
            view.setZoom(zoom + 1)
        }

        function reduceMap() {
            let zoom = view.getZoom();
            view.setZoom(zoom - 1)
        }

        function resetMap() {
            view.setCenter([114.30, 30.50])
            view.setZoom(4)
        }
    </script>
</body>

</html>